﻿@model IList<FCDB.Entity.EntityEx.WfProcessEx>
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ContentLayout.cshtml";
}
@section HeadIncluder 
{ 
    <link href='@Url.Content("~/Content/public.css")' rel="stylesheet" />
    <link href='@Url.Content("~/Content/con_style.css")' rel="stylesheet" />
}
<div class="content">
    <div class="ss_box list_tble" style="margin-top: 20px;">
        <div class="s_box1">
            <table class="s_tble ">
                <tr>
                    <td><span class="sous_tit">流程类型:</span>
                        <select id="ProcessTypeList" onchange="onRefresh()">
                            <option value="0">全部</option>
                            @{
                                IList<FCDB.Entity.WfProcessType> TypeList = ViewBag.WorkFlowTypeList as IList<FCDB.Entity.WfProcessType>;
                                foreach (var item in TypeList)
                                {
                                <option value="@item.ID">@item.Name</option>
                            }
                            }
                        </select></td>
                    <td><span class="sous_tit">名称:</span>
                        <input type="text" id="txtkeyword" name="keyword" class="keyword" value="" /></td>
                    <td style="margin-left: 8px;">
                        <span class="btn_s btn_c1" style="margin-left: 10px;"><a href="javascript:void(0)" onclick="onRefresh()">搜索</a></span>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div id="container" style="margin-right: 10px;">
        <div id="divGrid" style="width: 100%; height: 100%;">
            <table id="grid">
                <tr>
                    <th>流程名称</th>
                    <th >流程类型</th>
                </tr>
            </table>
        </div>
    </div>
</div>
<script id="rowTemplate" type="text/x-kendo-tmpl">
        <tr>
            <td><a href="javascript:void(0)" onclick="ShowUrl('#: PageUrl #','#: ProcessGUID #')" >#: ProcessName #</a></td>
           <td>#: ProcessTypeName #</td>
        </tr>
</script>
<script type="text/javascript">
  
    function ShowUrl(PageUrl, ProcessGUID) {
        var url = PageUrl + "?ProcessGuid=" + ProcessGUID;
        var width = screen.availWidth * 0.8;
        var top = screen.availWidth * 0.05;
        var left = screen.availWidth * 0.1;
        var height = screen.availHeight * 0.8;
        window.open(url, "", "width=" + width + "px, height=" + height + "px, top=" + top + "px, left=" + left + "px");
    }

    $(function () {
        loadData();
    });
    function loadData() {
        $("#grid").kendoGrid({
            dataSource: {
                serverPaging: true,
                pageSize: 10,
                transport: {
                    read: {
                        url: '@Url.Action("Index", "WorkFormApply")',
                        type: "POST",
                        dataType: "json",
                        data: {
                            keyword: function () {
                                return $("#txtkeyword").val();
                            },
                            typeId: function () {
                                return $("#ProcessTypeList").val();
                            }
                        }
                    },

                },
                schema: {
                    //取出資料陣列
                    data: function (d) { return d.Data; },
                    //取出資料總筆數(計算頁數用)
                    total: function (d) { return d.TotalCount; }
                }
            },
            height: 600,
          
            pageable: {
                refresh: true,
                pageSizes: true
            },
            //columns: [
            //    { field: "ProcessGUID", title: "ProcessGUID", hidden: true },
            //    { field: "PageUrl", title: "流程审核页", hidden: true },
            //    { field: "ProcessName", title: "流程名称"  },
            //    { field: "ProcessTypeName", title: "流程类型" },
            //    {
            //        command: { text: "拟稿", click: ProccessClickHander }, width: "140px", title: "操作"
            //    }
            //]
            rowTemplate: kendo.template($("#rowTemplate").html())
        });

    }
    function onRefresh() {
        var grid = $("#grid").data("kendoGrid");
        grid.dataSource.read();
    }
</script>



